package com.probox.common.entity.vo.statistics;

import cn.hutool.core.util.ObjectUtil;
import com.probox.common.core.enums.CardTypeEnum;
import com.probox.common.core.text.Convert;
import com.probox.common.core.utils.money.MoneyUtils;
import com.probox.common.entity.utils.DictUtils;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;

@Data
public class ReconciliationVo implements Serializable {

    private Long storeId;

    private Long payStoreId;

    private String startTime;

    private String endTime;

    /**
     * 服务类别
     */
    private String type;

    public String getTypeStr() {
        return CardTypeEnum.getNameByKey(type);
    }

    /**
     * 服务项目
     */
    private String proName;
    /**
     * 数量
     */
    private Integer itemNumber;
    /**
     * 价格
     */
    private Long price;

    public String getPriceStr() {
        return MoneyUtils.changeF2Y(price);
    }

    /**
     * 销售门店
     */
    private String saleStoreName;
    /**
     * 销售收款
     */
    private Long payAmount;

    public String getPayAmountStr() {
        return MoneyUtils.changeF2Y(payAmount);
    }

    /**
     * 收款门店
     */
    private String collectionName;
    /**
     * 收款金额
     */
    private Long collectionPrice;

    public String getCollectionPriceStr() {
        return MoneyUtils.changeF2Y(collectionPrice);
    }

    /**
     * 收款金币
     */
    private Long payGoldCoin;

    public String getPayGoldCoinStr() {
        return MoneyUtils.changeF2Y(payGoldCoin);
    }

    /**
     * 收款银币
     */
    private Long paySilverCoin;

    public String getPaySilverCoinStr() {
        return MoneyUtils.changeF2Y(paySilverCoin);
    }

    /**
     * 耗卡门店
     */
    private String cardConsumptionStoreName;
    /**
     * 耗卡项目
     */
    private String serviceName;
    /**
     * 耗卡次数
     */
    private Integer times;
    /**
     * 耗卡成本
     */
    private Long costPrice;

    public String getCostPriceStr() {
        return MoneyUtils.changeF2Y(costPrice);
    }

    /**
     * 成本结算门店就是收款门店
     */
    /**
     * 结算金额就是耗卡成本
     */
    /**
     * 服务技师(咨询师)
     */
    private String technicianName;
    /**
     * 客户来源
     */
    private String sourcePlatform;


    public String getSourcePlatformStr() {
        HashMap dictCacheMap = DictUtils.getDictCacheMap("source_platform");
        return Convert.toStr(dictCacheMap.get(sourcePlatform));
    }

    /**
     * 技术服务费
     */
    public String getTechnologyPrice() {
        if (ObjectUtil.isEmpty(payAmount)) {
            return "0";
        } else {
            double v = payAmount * 0.035 / 100;
            BigDecimal big = new BigDecimal(v);
            return big.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    private Long orderUid;

    private Long itemUid;

    //比例
    private Long itemServicePercent;

    //耗卡价
    private Long settlementPrice;
    public String getSettlementPriceStr() {
        return MoneyUtils.changeF2Y(settlementPrice);
    }

    //服务人数
    private Long manCount;
    //项目数
    private Long serviceAmount;

    private Double kuaDian;

    //统计类型，1为收入，2为支出
    private String countType;
}
